import Taro from '@tarojs/taro'
const BASE_URL = 'http://10.36.138.34:3000'
const VSESION = '/api/v1'

export default ({url, method, data}) => {
  return new Promise((resolve, reject) => {
    Taro.request({
      url: BASE_URL + VSESION + url,
      method,
      data,
      header: {
		    Authorization: Taro.getStorageSync('token')
      },
      success(res) {
        resolve(res.data.data)
      },
      fail(err) {
        reject(err)
      }
    })
  })
}